package com.lzy.openFeignTest.controller;

import cn.hutool.core.lang.Console;
import cn.hutool.json.JSONObject;
import com.lzy.conf.JSONResult;
import com.lzy.openFeignTest.orgFeign.SysRoleFeignService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  OpenFeign测试接口
 * </p>
 *
 * @author lcc
 * @since 2022年8月19日
 */
@RestController
@RequestMapping("/openFeignTest")
@Api(tags = "openFeignTest")
public class OpenFeignTestController {

    SysRoleFeignService sysRoleFeignService;

    @Autowired
    public OpenFeignTestController(SysRoleFeignService sysRoleFeignService) {
        this.sysRoleFeignService = sysRoleFeignService;
    }

    @ApiOperation("测试openFeign")
    @RequestMapping(value = "test",method = RequestMethod.POST)
    public JSONResult getAll() throws Exception{
        System.out.println("查询所有的流程列表-feign查询角色");
        JSONObject admin = sysRoleFeignService.selectByUid("admin");
        Console.log("role:{}",admin.toString());
        return JSONResult.ok();
    }
}
